import pickle


def load_res():
    with open(r'F:\mypython\final_subject\DWGI\doc_subject_res.txt', 'rb') as f:
        subject = pickle.load(f)

    with open(r'F:\mypython\final_subject\DWGI\res.txt', 'w', encoding='utf-8') as f1:
        for k, v in subject.items():
            if len(v) <= 10:
                for word in v:
                    f1.write(word)
                    f1.write(' ')
            else:
                for i in range(10):
                    f1.write(v[i])
                    f1.write(' ')
            f1.write('\n')


if __name__ == '__main__':
    load_res()